from typing import NamedTuple
from functools import wraps


class Dimesion(NamedTuple):
    width: float
    height: float


def dim(s: Dimesion):
    """
    传递`Dimesion` 的装饰器
    """

    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            print(f"width:{s.width}, height:{s.height}")
            return func(s, *args, **kwargs)

        return wrapper

    return decorator


size = Dimesion(14, 56)


@dim(size)
def get_area(s):
    area = s.width * s.height
    print("get_area is runing.")
    print(f"inside function - area:{area}")
    return area


# def get_values()


if __name__ == "__main__":
    result = get_area()
    print(f"outside get_rear() - area:{result}")
